const inquirer = require("inquirer");
const { getGitBranchs } = require("../utils/git.js");

// 问题
const questions = [
  {
    type: "list",
    name: "branch",
    message: "请选择要拉取一个模板分支",
    choices: getGitBranchs(),
    default: "",
  },
];

// 提问问题
const selectTemplate = async () => {
  try {
    return await inquirer.prompt(questions);
  } catch (err) {
    Promise.reject("取消操作");
  }
};

module.exports = selectTemplate;
